<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../../scripts/jquery.min.js"></script>
    <script src="../../../scripts/miniui/miniui.js"></script>
    <link rel="stylesheet" href="../../../scripts/miniui/themes/default/miniui.css">
    <script type="text/javascript">
        mini.parse();


        function submitForm() {


            //提交表单数据
            var form = new mini.Form("#form1");
            var data = form.getData();      //获取表单多个控件的数据
            var json = mini.encode(data);   //序列化成JSON
            $.ajax({
                url: "/device/genDeviceId",
                type: "post",
                data: data,
                success: function (text) {
                    const link=document.createElement("a");
                    link.href=text;
                    link.download="uuid.csv";
                    link.click();
                }
            });

        }

    </script>
</head>
<body>
<div id="form1" >

    <table>
        <tr>
            <td>设备类型</td>
            <td>
                <mini-combobox name="deviceId" style="width:250px;"  popupWidth="400" textField="name" valueField="id"
                               url="/device/getDevices"   showClose="true" oncloseclick="onCloseClick" >
                    <columns>
                        <column header="设备类型" field="id"></column>
                        <column header="设备名称" field="name"></column>
                    </columns>
                </mini-combobox>
            </td>
            <td>
                <a class="mini-button" onclick="submitForm()" >生成</a>
            </td>

        </tr>
    </table>
</div>
</body>
</html>